<?php

class Ext_Image_Download_Result
{
    const SUCCESS                                    =  1;
    const NOTHING                                    =  0;
    const FAILURE                                    = -1;
    const FAILURE_UNCATEGORIZED                      = -20;

    protected $_code;
    protected $_imageFile;
    protected $_messages;

    public function __construct($code, $data, array $messages = array())
    {
        $code = (int) $code;

        if ($code < self::FAILURE_UNCATEGORIZED) {
            $code = self::FAILURE;
        } elseif ($code > self::SUCCESS ) {
            $code = 1;
        }

        $this->_code      = $code;
        $this->_data      = $data;
        $this->_messages  = $messages;
    }

    public function isValid()
    {
        return ($this->_code > 0) ? true : false;
    }

    public function getCode()
    {
        return $this->_code;
    }

    public function getData()
    {
        return $this->_data;
    }

    public function getMessages()
    {
        return $this->_messages;
    }
}
